﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Photo_Manipulator
{
    public partial class ImagePreview : Form
    {
        string previewFile;
        const int IMG_WIDTH = 400;
        const int IMG_HEIGTH = 300;
        public ImagePreview(string filePath)
        {
            InitializeComponent();
            previewFile = filePath;
            Image img = System.Drawing.Image.FromFile(previewFile);
            this.AutoScrollMinSize = new Size(IMG_WIDTH+100, IMG_HEIGTH+100);
            this.AutoScroll = false;
            pbPreview.Image = img.GetThumbnailImage(IMG_WIDTH, IMG_HEIGTH, null, IntPtr.Zero);
        }

        private void btnFullSize_Click(object sender, EventArgs e)
        {
            Image img = System.Drawing.Image.FromFile(previewFile);
            this.AutoScrollMinSize = new Size(img.Width, img.Height);
            this.AutoScroll = true;
            pbPreview.Image = img;
           // ImagePreview.
           // pbPreview.BringToFront = true;
        }

        private void btnRescaled_Click(object sender, EventArgs e)
        {
            Image img = System.Drawing.Image.FromFile(previewFile);
            this.AutoScrollMinSize = new Size(IMG_WIDTH+100, IMG_HEIGTH+100);
            this.AutoScroll = false;
            pbPreview.Image = img.GetThumbnailImage(IMG_WIDTH, IMG_HEIGTH, null, IntPtr.Zero);
        }
    }
}
